﻿using System;

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {
            ///字符串
            string song = "情深深雨濛濛";
            Console.WriteLine(song.Length);
            for (int i = 0; i <= song.Length-1; i++)
            {
                Console.WriteLine(song[i]);
            }
           
            Console.WriteLine("第一次出现的位置："+song.IndexOf("深"));
            Console.WriteLine("最后一次出现的位置："+song.LastIndexOf("濛"));

            Console.WriteLine("判断是否以情开头："+song.StartsWith("情"));
            Console.WriteLine("判断是否以濛结尾："+song.EndsWith("濛"));

            string animal = "Monkey";
            Console.WriteLine("全部换成大写字母："+animal.ToUpper());
            Console.WriteLine("全部换成小写字母："+animal.ToLower());
            Console.WriteLine("替换:"+animal.Replace("Mon","many"));

            string human = "    teacher     ";
            Console.WriteLine("m"+human+"m");
            Console.WriteLine("去除掉前后空格："+human.Trim());
            Console.WriteLine("去除掉前面的空格："+human.TrimStart());
            Console.WriteLine("去除掉后面的空格"+human.TrimEnd());

            string name = "huang";
            Console.WriteLine(name);
            int h = 2;//移除字符串
            Console.WriteLine(name.Remove(h));

            string week = "Monday";
            Console.WriteLine("截取字符串:"+week.Substring(2,2));
            Console.WriteLine("插入："+week.Insert(6,"s"));

            string province = "北京|上海|四川|福建";
            char[] area= new char[] {'|'};//分割字符串
            string[] t = province.Split(area);
            for (int i = 0; i <= province.Length; i++)
            {
                Console.WriteLine(t[i]);
            }


     

            
        }
    }
}
